//引入vue
import Vue from "vue";
import VueRouter from 'vue-router';
Vue.use(VueRouter);


//
import page1  from "./page1.vue";
import page2  from './page2.vue';
import user   from './user.vue';
import computer from './computer.vue';
import h  from './components/h.vue';
import el_index from './el/index.vue';
import vants from './vant/index.vue';
import muse from './muse/index.vue'; 

//定义routes路由的集合，数组类型

const routes =[ 
 	// { path: '/page1', component: page1 },
 	// {path:'',redirect:"page1"},
 	{ 
 		path: '/page1/:id&:s', component: page1,name:'haha',
 		children: [
            {
                path: "computer",
                component: computer
            },
           
    	]

 	},
 	{
 		path:'/el/index',component:el_index,name:'index'
 	},

  { path: '/page2', component: page2 },
  { path: '/components/h', component: h,name:'h' },
  { path: '/vant/index', component: vants,name:'vants' },
  { path: '/muse/index', component: muse,name:'muse' },

  	//  //使用冒号标记，当匹配到的时候，参数值会被设置到this.$route.params中
   //  {path:"/user/:name",component:user}
]

//实例化VueRouter并将routes添加进去
const router = new VueRouter({
  routes // （缩写）相当于 routes: routes
})

///抛出这个这个实例对象方便外部读取以及访问

export default router;